package com.cnap.multiclouldmgmt.model.log;

/**
 * 操作类型枚举
 *
 * @author xc
 **/
public enum OperationTypeEnum {
    LOGIN("登录"),
    LOGOUT("退出"),
    ADD("添加"),
    DELETE("删除"),
    OTHER("其他");

    private final String type;

    OperationTypeEnum(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    /**
     * 判断是否时合法的操作类型
     *
     * @param operationTYpe 操作类型的字符
     * @return 结果
     */
    public static boolean isValidOperationType(String operationTYpe) {
        OperationTypeEnum[] operationTypeEnums = OperationTypeEnum.values();
        for (OperationTypeEnum typeEnum : operationTypeEnums) {
            if (typeEnum.getType().equals(operationTYpe)) {
                return true;
            }
        }
        return false;
    }
}
